package com.esperia09.webservice.mixibot.oauth;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.esperia09.webservice.mixibot.SessionIO;

@SuppressWarnings("serial")
public class OAuthCallbackServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
		resp.setContentType("text/plain");
		// resp.getWriter().println("Hello, world");

		// SessionにAuthorizationCodeを埋め込む
		String authorizationCode = req.getParameter("code");
		SessionIO.setMixiAuthorizationCode(req, authorizationCode);
	
		resp.getWriter().println("ACode : " + SessionIO.getMixiAuthorizationCode(req));
		resp.sendRedirect("/mixi_bot");
	}
}
